<template>
  <div class="app-container">
    <div style="margin-bottom: 10px">
      <el-tag type="success"><span style="font-size: 20px;font-weight: bold">培训记录</span></el-tag>
    </div>
    <el-table :data="trainList" style="width: 100%;margin-top:30px;" border>
      <el-table-column align="center" prop="name" label="名字">
        <template slot-scope="scope">
          {{ scope.row.name }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="trainDate" label="培训日期">
        <template slot-scope="scope">
          <el-date-picker readonly v-model="scope.row.trainDate" type="datetime" placeholder="培训日期"></el-date-picker>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="content" label="培训内容" width="180">
        <template slot-scope="scope">
          {{ scope.row.content }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="remark" label="备注">
        <template slot-scope="scope">
          {{ scope.row.remark }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="status" label="状态">
        <template slot-scope="scope">
          <el-select v-model="scope.row.status" disabled style="margin-left: 10px;width: 80%" placeholder="状态">
            <el-option
              v-for="status in statusEnum"
              :key="status.value"
              :label="status.label"
              :value="status.value">
            </el-option>
          </el-select>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getMyTrain } from '@/api/train'

export default {
  name: 'TrainMine',
  data() {
    return {
      trainList: [],
      statusEnum: [
        { value: 'BEGINNING', label: '正在进行' },
        { value: 'END', label: '结束' },
        { value: 'NOT_BEGIN', label: '未开始' },
        { value: 'FALSE', label: '无效' }
      ]
    }
  },
  created() {
    this.getTrainList()
  },
  methods: {
    async getTrainList() {
      await getMyTrain().then((res) => {
        this.trainList = res.data
      })
    }
  }
}
</script>

<style scoped>

</style>
